#include <iostream>
#include <string>

using namespace std;

// 产品的抽象类
class Doc
{
private:
    string _name;
public:
    Doc() {}
    Doc(string name) 
    :_name(name)
    {

    }
    ~Doc() {}
    virtual void open() {
        cout << "open:" << _name << endl;
    }
    virtual void close() {
        cout << "close:" << _name << endl;
    }
    // 纯虚函数 子类要对其进行重写
    // virtual void exit() = 0;

};

class Word
:public Doc
{
private:
public:
    Word(string name) 
    :Doc(name)
    {}
    ~Word() {}
};

class Excel
:public Doc
{
private:
public:
    Excel(string name)
    :Doc(name)
    {}
    ~Excel() {}
};

class Ppt
:public Doc
{
private:
public:
    Ppt(string name) 
    :Doc(name)
    {}
    ~Ppt() {}
};
typedef enum
{
    WORD,
    EXECL,
    PPT
}Doctype;

// 工厂类
class Factory
{
private:
public:
    Factory() {}
    ~Factory() {}
    static Doc* create(Doctype type, string name = "新建文件") {
        Doc *d;
        switch (type)
        {
        case WORD:
            break;
        default:
            break;
        }
    }
};
int main(int argc, char const *argv[])
{
    
    return 0;
}
